<template>
    <div class="ui grid form sp-auditfc">
        <div class="row ">
            <div class="eight wide column" v-for="list in this.orderList">
                <table class="ui celled table">
                    <tbody>
                    <tr v-for="item in list">
                        <td><span class="ui small header">{{item.name}}</span></td>
                        <td v-if="item.map">{{item.map[item.value]}}</td>
                        <td v-else>{{item.value}}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="center-box">
            <button class="ui primary button" @click.prevent.stop="auditFc">审核通过</button>
            <button class="ui button" @click.prevent.stop="hideMypop">取消</button>
        </div>
    </div>
</template>

<script>
    import tool from 'src/util/tool';
    import util from '_util/index';
    import logic from '_logic';
    export default {
        props: ['id'],
        data(){
            return {
                orderData:{},
                orderList:{
                    list_1: {
                        sp_order_num: {name: '订单号码', value: ""},
                        sp_status:{name:'供应商订单状态',value:'',map:{
                            0 :'未支付', 1 :'待分成', 2 : '已分成', 3 :'已退款'
                        }},
                        delivery_status: {name: '发货状态', value: 1,map:{
                            0 : '未发货', 1 : '已发货'
                        }},
                        qd_name: {name: '渠道', value: ""},
                        sp_name: {name: '供应商', value: ""},
                        tzu_name: {name: '服务者', value: ""},
                        user_name: {name: "用户", value: ""},
                        pname: {name: '商品', value: ""},
                        pnum: {name: '数量', value: 0},
                        pay_money: {name: "金额", value: 0},
                        remark: {name: '备注', value: ''},
                    },
                    list_2: {
                        buy_platform:{name:'购买平台',value:'',map:{
                            1:'公众号',2:'企业号',3:'ios平台',4:'android平台',5:'同业人'
                        }},
                        pay_platform:{name:'支付平台',value:'',map:{
                            1:'微信', 2 :'支付宝', 3 :'余额支付', 4 :'授信支付'
                        }},
                        target_date: {name: '预定时间', value: "0000-00-00"},
                        fc_server: {name: '服务者分成', value: 0},
                        fc_server_up: {name: '场景分成', value: 0},
                        fc_sp: {name: '供应商分成', value: 0},
                        status:{name:'商品支付状态',value:'',map:{
                            0 :'未支付', 1: '已支付', 2 :'已完成', 3 :'已退款'
                        }},
                        fc_status:{name:'商品分成状态',value:'',map:{
                            0 : '无', 1 : '待分成', 10 :'已分成', 20 : '已退款'
                        }}
                    },
                },
            }

        },
        watch: {
            id:function () {
                this.getOrderDetail()
            }
        },
        created(){
            this.getOrderDetail()
        },
        methods: {
            hideMypop(){
                this.$store.state.global.eventVue.$emit('hideMypop')
            },
            getOrderDetail(){
                util.http.getDataCom(this, tool.getApi(this, 'Show', 'sp_order_detail'), {id: this.id}, (rs) => {
                    this.orderData = rs[0];
                    Object.keys(this.orderList.list_1).forEach(item =>{
                        this.orderList.list_1[item].value = this.orderData[item]
                    })
                    Object.keys(this.orderList.list_2).forEach(item =>{
                        this.orderList.list_2[item].value = this.orderData[item]
                    })
                })
            },
            auditFc(){
                let url = tool.getApi(this, 'Op', 'audit_fc');
                let param = {
                    id: this.id
                };
                util.http.SR(this, url, param, '审核成功', (rs) => {
                    logic.list.refreshListData(this);
                    this.hideMypop()
                });
            }
        }
    }
</script>

<style lang="less" rel="stylesheet/less" scoped>
    .sp-auditfc {
        margin: 0 !important;
        .row {
            .column {
            }
        }
        .center-box {
            text-align: center;
            width: 100%;
        }
    }
</style>
